package com.hzw.saas.api.hpc.enums;

import java.util.Objects;

/**
 * @author sonam
 * @since 02/04/2021
 */
public enum HpcContractStatus {
    EXPIRED(0, "合同到期(失效)"),
    FAILS_PERFORM(1, "未履行"),
    PERFORM(2, "履行中"),
    PERFORM_FINISHED(3, "履行完毕"),
    ;

    private final Integer value;
    private final String text;

    HpcContractStatus(Integer value, String text) {
        this.value = value;
        this.text = text;
    }

    public Integer value() {
        return value;
    }

    public String text() {
        return text;
    }

    public static String text(Integer value) {
        for (HpcContractStatus hpcContractStatus : HpcContractStatus.values()) {
            if (Objects.equals(hpcContractStatus.value, value)) {
                return hpcContractStatus.text;
            }
        }
        return null;
    }

    public static HpcContractStatus instance(Integer value) {
        for (HpcContractStatus hpcContractStatus : HpcContractStatus.values()) {
            if (Objects.equals(hpcContractStatus.value, value)) {
                return hpcContractStatus;
            }
        }
        return null;
    }

    public static HpcContractStatus instance(String text) {
        for (HpcContractStatus hpcContractStatus : HpcContractStatus.values()) {
            if (Objects.equals(hpcContractStatus.text, text)) {
                return hpcContractStatus;
            }
        }
        return null;
    }
}
